package com.cms.portal.controller.admin;

import com.cms.context.utils.UtilsShiro;
import com.cms.context.utils.UtilsTemplate;
import com.google.code.kaptcha.Producer;
import org.apache.shiro.subject.Subject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;

import javax.imageio.ImageIO;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.io.OutputStream;

/**
 * 登陆模块
 */
@Controller
public class LoginController {

    @Autowired
    private Producer   captchaProducer;

    @GetMapping("login.do")
    public String toLogin(){
        Subject subject = UtilsShiro.getSubject();
        if(subject.isAuthenticated()){
            return "redirect:index.do";
        }
        return UtilsTemplate.adminTemplate("login");
    }






}
